# Directory structure
SRC = ./src
INC = ./include
BIN = ./bin
TST = ./testes
PRF = ./perf

# compiler
CC = gcc

# Options for release
#CFLAGS = -O -Wall
# Options for the development
CFLAGS = -Wall -g
VFLAGS = --leak-check=full --show-reachable=yes --track-origins=yes

################################################################################
#                                                                              #
# Main targets                                                                 #
#                                                                              #
################################################################################
all:
	$(CC) -I $(INC) -o $(BIN)/lrusimul $(SRC)/lrusimul.c $(SRC)/memory.c $(SRC)/process_list.c $(SRC)/page_table.c $(CFLAGS) 
	
tst0: all
	valgrind $(BIN)/lrusimul $(TST)/config0.txt $(VFLAGS)
	cat $(PRF)/log.txt
	
tst1: all
	valgrind $(BIN)/lrusimul $(TST)/config1.txt $(VFLAGS)
	cat $(PRF)/log.txt

tst2: all
	valgrind $(BIN)/lrusimul $(TST)/config2.txt $(VFLAGS)
	cat $(PRF)/log.txt

tst3: all
	valgrind $(BIN)/lrusimul $(TST)/config3.txt $(VFLAGS)
	cat $(PRF)/log.txt
	
tst4: all
	valgrind $(BIN)/lrusimul $(TST)/config4.txt $(VFLAGS)
	cat $(PRF)/log.txt
	
tst5: all
	valgrind $(BIN)/lrusimul $(TST)/config5.txt $(VFLAGS)
	cat $(PRF)/log.txt
	
tst6: all
	valgrind $(BIN)/lrusimul $(TST)/config6.txt $(VFLAGS)
	cat $(PRF)/log.txt

# clean up	
clean:
	rm -rf $(BIN)/*	    # remove all binaries
	rm $(PRF)/log.txt # remove log.txt
	clear


################################################################################
#                                                                              #
# Tests                                                                        #
#                                                                              #
################################################################################


# TIPS
# 1- Libs and Headers linkage
#    http://stackoverflow.com/questions/5846804/multiple-include-paths-with-gcc-c
